package com.gyj.Actor.service.impl;

import com.github.pagehelper.PageHelper;
import com.gyj.Actor.mapper.CityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.gyj.Actor.po.City;
import com.gyj.Actor.po.Country;
import com.gyj.Actor.service.CityService;

import java.util.List;

@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 5)
@Service
public class CityServiceImpl implements CityService {

    @Autowired
    CityMapper citymapper;

    public List<City> getCitylist() {
        List<City> cityList = citymapper.getCitys();
        return cityList;
    }

    public List<City> getpagecitylist(int pagenum, int pagesize) {
        PageHelper.startPage(pagenum, pagesize);
        List<City> cityList = citymapper.getCitys();
        return cityList;
    }

    public List<City> getCountryCity(String Countryname) {
        List<City> cityList = citymapper.getCountrycity(Countryname);
        return cityList;
    }

    public List<City> getpageCountryCity(String Countryname, int pagenum,
                                         int pagesize) {
        PageHelper.startPage(pagenum, pagesize);
        List<City> cityList = citymapper.getCountrycity(Countryname);
        return cityList;
    }

    public Country getCountryCitys(String Countryname) {
        return citymapper.getCitysbyCountry(Countryname);
    }

}
